# def add(a,b):
#     pass
# print(add(1,2))

def ask_ok(prompt, retries=4, reminder='Please try again!'):
    while True:
        ok = input(prompt)
        if ok in ('y', 'ye', 'yes'):
            return True
        if ok in ('n', 'no', 'nop', 'nope'):
            return False
        retries = retries - 1
        if retries <= 0:
            raise ValueError('无效的响应')
        print(reminder)

# ask_ok('你想放弃吗？')
ask_ok('你想放弃吗？', 3, '请重新输入！')